c# linq unique by property

96

c# linq unique by property -

List<Person> distinctPeople = allPeople
   .GroupBy(p => p.PersonId)
   .Select(g => g.FirstOrDefault())
   .ToList();

c# linq unique by property -

Persons.ToLookup(p => p.Id).Select(coll => coll.First());

Comments

Submit
0 Comments